<template>
  <div class="top-view">
    <div class="top-title">
      <div class="top-title-flex">
        <div>后台管理系统</div>
        <div class="top-title-crumbs">
          
        </div>
      </div>
    </div>
    <div class="top-btn">
      <el-popconfirm
        confirm-button-text="退出"
        cancel-button-text="取消"
        icon-color="#626AEF"
        title="是否退出登录?"
        @confirm="delToken"
        @cancel="cancelEvent"
      >
        <template #reference>
          <el-button type="primary" class="btnButton" plain>{{
            btnTitle
          }}</el-button>
        </template>
      </el-popconfirm>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent } from "vue";
import { SwitchButton } from "@element-plus/icons-vue";
import { ElMessage } from "element-plus";
import { useStore } from "vuex";
export default defineComponent({
  emits: {
    changeDelToken: null,
  },
  setup(props, content) {
    const store = useStore();

    const btnTitle = store.state.btnTitle;

    const delToken = () => {
      content.emit("changeDelToken");
    };

    const cancelEvent = () => {
      ElMessage({
        message: "取消退出",
        type: "info",
      });
    };
    return { delToken, cancelEvent, btnTitle };
  },
});
</script>

<style scoped lang="scss">
.top-view {
  display: flex;
  justify-content: space-between;
  .top-title {
    height: 50px;
    line-height: 50px;
    font-size: 18px;
    font-weight: bolder;
    color: #e8e83e;
    .top-title-flex{
      display: flex;
      .top-title-crumbs{
        margin-left: 15px;
      }
    }
  }
  .top-btn {
    height: 50px;
    line-height: 50px;
    .btnButton {
      border-radius: 15px;
    }
  }
}
</style>
